#include <memory.h>
#include "CommBaseQt.h"

#include <QThread>

CommBaseQt::CommBaseQt(QObject* parent)
    :QObject(parent)
{
}

CommBaseQt::~CommBaseQt()
{
    printf("CommBaseQt derived() is called!\n\n");
}

int CommBaseQt::ReadAndParse()
{
    while(true)
    {
        int BUFFER_SIZE = 1024;
        unsigned char buf[BUFFER_SIZE];
        memset(buf,0,BUFFER_SIZE);
        int ret = Read(buf,BUFFER_SIZE);
        if(ret<=0)
        {
            break;
        }
        if(ExtractFun != nullptr)
        {
            ExtractFun(buf,ret);
        }
    }
    return 1;
}

